<template>
	<view class="content">
		<!-- <web-view src="/hybrid/html/web/viewer.html"></web-view> -->
		<web-view v-if="webviewShow" :src="externalUrl" @message="sendMsg"></web-view>
	</view>
</template>

<script>
	import { aggregationList } from '@/common/api/api'
	export default {
		data() {
			return {
				externalUrl: '',
				webviewShow: false
			}
		},
		onShow() {
			this.loadAggregation(1);
		},
		onReady() {
			// this.externalUrl = `http://192.168.1.69:8081/?token=${ uni.getStorageSync('token') }`
			// this.externalUrl = `http://192.168.1.88:8082/?token=${ uni.getStorageSync('token') }`
			this.externalUrl = `/hybrid/html/map/index.html?token=${ uni.getStorageSync('token') }`
		},
		methods: {
			loadAggregation(level) {
				aggregationList({level}).then((res)=> {
					if(res.code == 20000){
						this.webviewShow = true;
					}
				})
			},
			sendMsg(e) {
				console.log(e);
			}
		}
	}
</script>

<style>
	.content {
	  width: 100vw;
	  height: 100vh;
	}
</style>
